<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>猜数游戏</title>
    <script>
        var targetNumber = Math.round(Math.round()*100);
        // console.Log(targetNumber);

        function checkNumber(){
            var guessNumber =document.getElementById('guessNumber').value;
            console.log(guessNumber);
            if(guessNumber < targetNumber){
                //输出猜的数字小了
                document.getElementById('notice').innerText = "猜错了，数小了";
            }else if(guessNumber > targetNumber){
                //输出猜的数字大了
                document.getElementById('notice').innerText = "猜错了，数大了";
            }else if(guessNumber > targetNumber){
                //恭喜你猜对了
            }
        }
  </script>
</head>
<body>
    <p>系统现在随机生成了一个1-100数字，请输入你觉得可能生成的数字</p>
    <input type="text"id="getElementById" autocomplete="false" placeholder="请输入一个1-100的整数">
    <input type="button" value="提交" onclick="checkNumber()">
    <p id="notice"></p>
</body>
</html>